load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "handle",
    srcs = [
        "bootstrap.go",
        "handle.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/statistics/handle",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/ddl/notifier",
        "//pkg/infoschema",
        "//pkg/kv",
        "//pkg/meta/autoid",
        "//pkg/meta/model",
        "//pkg/parser/mysql",
        "//pkg/parser/terror",
        "//pkg/session/syssession",
        "//pkg/sessionctx",
        "//pkg/sessionctx/sysproctrack",
        "//pkg/sessionctx/vardef",
        "//pkg/statistics",
        "//pkg/statistics/handle/autoanalyze",
        "//pkg/statistics/handle/cache",
        "//pkg/statistics/handle/ddl",
        "//pkg/statistics/handle/globalstats",
        "//pkg/statistics/handle/history",
        "//pkg/statistics/handle/initstats",
        "//pkg/statistics/handle/lockstats",
        "//pkg/statistics/handle/logutil",
        "//pkg/statistics/handle/storage",
        "//pkg/statistics/handle/syncload",
        "//pkg/statistics/handle/types",
        "//pkg/statistics/handle/usage",
        "//pkg/statistics/handle/util",
        "//pkg/table",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/filter",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/slice",
        "//pkg/util/sqlexec",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "handle_test",
    timeout = "short",
    srcs = [
        "bootstrap_test.go",
        "main_test.go",
    ],
    embed = [":handle"],
    flaky = True,
    race = "on",
    shard_count = 5,
    deps = [
        "//pkg/testkit/testsetup",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
